<template>
  <div id="selectionlist" class="xuanbuDetail">
    <section class="wboxnoborder">
          <div v-show="loading">加载中...</div>
          <el-form v-show="!loading" ref="form"
            label-width="150px"
            label-position="right">
            <el-form-item label="谈话人" style="float:left">
              <span class="selectioncontent">{{detail.talkPerson}}</span>
            </el-form-item>
            <el-form-item label="谈话时间" style="float:left">
              <span class="selectioncontent">{{detail.talkTime}}</span>
            </el-form-item>
            <el-form-item label="是否完成" style="float:left">
              <span v-show="detail.complete" class="selectioncontent">是</span><span v-show="!detail.complete" class="selectioncontent">否</span>
            </el-form-item>
            <el-form-item label="附件" style="clear:both">
              <div  v-for="(item, index) of detail.files" :key="index">
                <a :href="$http.defaults.baseURL+$http.defaults.selectionAPI+'api/gen/file/download?id='+item.id">{{item.fileName}}.{{item.fileType}}</a>
              </div>
            </el-form-item>
          </el-form>
          <notice :noticePersonId="personId" step="10"></notice>
    </section>
  </div>
</template>

<script>
import notice from '../common/Notice'
export default {
  props: ['personId'],
  watch: {
    personId: {
      handler (val, oldVal) {
        console.log('newval:' + val)
        this.getDetail(val)
      },
      immediate: true
    }
  },
  components: {
    notice
  },
  data () {
    return {
      loading: false,
      detail: {}
    }
  },
  methods: {
    getDetail (personid) {
      if (personid) {
        this.loading = true
        this.$http
          .get(this.$http.defaults.selectionAPI + `api/selection/talks/getTalkInfoByPerson?talkType=2&personId=` + personid)
          .then(response => {
            this.loading = false
            if (response.data.success) {
              this.detail = response.data.result
            } else {
              this.$message({
                message: '获取失败:' + response.data.message,
                type: 'error'
              })
            }
          })
          .catch(error => {
            this.loading = false
            this.$message({
              message: '网络获取失败:' + error,
              type: 'error'
            })
          })
      }
    }
  }
}
</script>

<style>
.xuanbuDetail .el-form-item{
  margin-bottom:0;
}
  #selectionlist .wboxnoborder .el-table{
    border: #95B8E7 solid 1px;
  }
  #selectionlist .wboxnoborder .el-table th{
    font-weight: normal;
    background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
    text-align: center;
    border-right: #95B8E7 solid 1px;
    border-bottom: #95B8E7 solid 1px;
    min-height: 30px;
    line-height:30px;
  }
  #selectionlist .wboxnoborder .el-table td, .el-table th{
    padding:0;
    font-size:var(--size14) !important;
    line-height: 20px;
    font-family: '宋体';
    text-align: center;
  }
  #selectionlist .el-table__row{
    height: 50px;
  }
  .xuanbuDetail .sel-con{
    font-weight: bolder
  }
</style>
<style scoped>
  #selectionlist .cell i {
    width: 30px;
    height: 30px;
    background-position: center center;
    background-repeat: no-repeat;
    float: center;
    display: block;
    cursor: pointer;
    margin: 0 auto;
  }
  .workflowmsg ul{
    background:#F5F7FA;
    margin:0 20px 20px;
    padding:10px 0;
  }
  .workflowmsg li{
    padding:0;
    list-style: none;
    margin-left:20px;
    line-height: 200%;
    font-size:var(--size) !important;
  }
  h1{
    font-size:var(--size16) !important;
    font-weight: bolder;
    height: 30px;
    border-bottom: 1px solid #95B8E7;
    font-family: '宋体';
    line-height: 30px;
    color: #000;
    padding-left:10px;
    background-image: linear-gradient(to bottom , #EEF4FF, #E0ECFF);
    margin:0;
  }
  h3{
    font-size:var(--size16) !important;
    font-weight: bolder;
    padding-left: 20px;
  }
  .el-pagination{
    float: left;
    padding:7px 10px;
  }
  .wboxs{
    padding:5px 15px;
    width: calc(100% - 30px);
    background: #fff;
    border: 1px solid #95B8E7;
    margin:0 10px;
    overflow: hidden;
  }
  #selectionlist .wboxnoborder{
    padding:0;
    width: calc(100% - 0px);
    background: #fff;
    margin:0 10px;
    overflow: hidden;
  }
</style>
